function barEvt(seriesData, xData, ele, color) {
//	var triggerType=type==='bar'?'axis':''
var legendData= []
	var barOption = {
		color: color,
		dataZoom: [],
		legend: {
			textStyle: {
				color: '#fff'
			},
      data:legendData
    },
		tooltip: {
			trigger: 'axis',
//			formatter: '{a}<br />{b} : {c}',
			axisPointer: {
				type: 'shadow',
			},
//			backgroundColor: 'rgba(9,89,124,0.8)',
//			borderWidth: 1,
//			borderColor: 'rgba(6,214,224,0.5)',
//			textStyle: {
//				color: '#4ff2f4'
//			}
		},
		grid: {
			left: '3%',
			top: '10%',
			right: '5%',
			bottom: '2%',
			containLabel:true
		},
		xAxis: {
			type: 'category',
			boundaryGap: true,
			splitLine: { //grid区域分隔线
				show: false,
				lineStyle: {
					width: 1,
					type: "solid",
					color: "#2a3f7e"
				}
			},
			axisLabel: { //坐标轴标签
				show: true,
				textStyle: {
					color: '#c0d4da'
				},
				interval: false,
				rotate: 25,
			},
			axisTick: {
				show: true, //刻度线
				color: "#c0d4da"
			},
			axisLine: {
				show: true, //坐标轴轴线
				lineStyle: {
					width: 1,
					color: "#c0d4da"
				}
			},
			data: xData
		},
		yAxis: {
			//name : '单位/万',
			splitLine: { //grid区域分隔线
				show: true,
				lineStyle: {
					width: 1,
					type: "solid",
					color: "#2a3f7e"
				}
			},
			axisTick: {
				show: true, //刻度线
				color: '#c0d4da'
			},
			axisLine: {
				show: true, //坐标轴轴线
				lineStyle: {
					width: 1,
					color: "#c0d4da"
				}
			},
			axisLabel: { //坐标轴标签
				show: true
			},
		},
		series: []
	};
	if(seriesData.length > 0){
		seriesData.forEach(function(item, index){
			legendData.push(item.name)
			barOption.series.push({
			name: item.name,
			type: 'bar',
			data: item.data,
			itemStyle: {
				normal: {
		//					color: '#0ea4e3'
					}
				},
			})
		})
	}else{
		barOption.series= [{
//			legendData.push(seriesData.name),
			name: seriesData.name,
			type: 'bar',
			data: seriesData.data
		}]
	}
	if(ele==='ecBar'){
		barOption.dataZoom= [
      {
        type: 'slider',
        show: true,
        start: 0,
        end: 20,
        handleSize: 8,
        textStyle: {
        	color: '#fff'
        }
      }
    ]
		barOption.grid= {
			left: '3%',
			top: '5%',
			right: '5%',
			bottom: '5%',
			containLabel:true
		}
	}
	var barChart = echarts.init(document.getElementById(ele))
	barChart.setOption(barOption);
	barChart.on('click', function(params){
		console.log(params)
		$(".winBar").fadeIn()
	})
	window.addEventListener("resize", function() {
		barChart.resize();
	});
}

//活跃数据监控
var xData= ['2018-12-6', '2018-12-7', '2018-12-8', '2018-12-9', '2018-12-10', '2018-12-11', '2018-12-12', '2018-12-13']
var color= ['#f4e925', '#e5004f', '#4fe3de', '#a1f379']
var seriesData = {name: 'p节点失败', data: [236,435,656,345,89,767,156,456]}
barEvt(seriesData, xData, 'activeMonitor', color)

//分区情况展示
var xData= ['2018-12-6', '2018-12-7', '2018-12-8', '2018-12-9', '2018-12-10', '2018-12-11', '2018-12-12', '2018-12-13']
var color= ['#e5004f', '#4fe3de', '#f4e925', '#a1f379']
var seriesData = {name: 'p节点失败', data: [236,435,656,345,89,767,156,456]}
barEvt(seriesData, xData, 'partition', color)

//
var xData= ['1','2','3','4','5','6','7','8','1','2','3','4','5','6','7','8','1','2','3','4','5','6','7','8','1','2','3','4','5','6','7','8']
var color= ['#4fe3de', '#e5004f', '#f4e925', '#a1f379']
var seriesData = {name: 'p节点失败', data: [236,435,656,345,89,767,156,456,236,435,656,345,89,767,156,456,236,435,656,345,89,767,156,456,236,435,656,345,89,767,156,456]}


barEvt(seriesData, xData, 'ecBar', color)


//segment状态监控
var xData= ['2018-12-6', '2018-12-7', '2018-12-8', '2018-12-9', '2018-12-10', '2018-12-11', '2018-12-12', '2018-12-13']
var color= ['#f4e925', '#e5004f', '#4fe3de', '#a1f379']
var seriesData = [
	{name: 'p节点失败', data: [236,435,656,345,89,767,156,456]},
	{name: 'M节点失败', data: [34,156,156,156,156,120,54,78]},
	{name: 'p节点成功', data: [455,156,56,156,156,156,156,97]},
	{name: 'M节点成功', data: [156,156,453,456,156,786,723,56]}
]

barEvt(seriesData, xData, 'barWeg', color)

//接口机文件目录
var xData= ['2018-12-6', '2018-12-7', '2018-12-8', '2018-12-9', '2018-12-10', '2018-12-11', '2018-12-12', '2018-12-13']
var color= ['#f4e925', '#e5004f', '#4fe3de', '#a1f379']
var seriesData = [
	{name: 'p节点失败', data: [236,435,656,345,89,767,156,456]},
	{name: 'M节点失败', data: [34,156,156,156,156,120,54,78]},
	{name: 'p节点成功', data: [455,156,56,156,156,156,156,97]},
	{name: 'M节点成功', data: [156,156,453,456,156,786,723,56]}
]

barEvt(seriesData, xData, 'barFile', color)


